Skip to content

Implement the graph, worker and orchestrator base classes and parallel search and beam search algorithms#63

Merged
shangkunwang01 merged 16 commits into
mainfrom
shangkun-auto-search
Jul 22, 2026
Merged

Implement the graph, worker and orchestrator base classes and parallel search and beam search algorithms#63
shangkunwang01 merged 16 commits into
mainfrom
shangkun-auto-search

Conversation

@shangkunwang01

@shangkunwang01 shangkunwang01 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator
  1. Implement the graph, worker and orchestrator base classes;
  2. Implement the parallel search algorithm;
  3. Implement the beam search algorithm;
  4. Prepare the run search and run batch search scripts.

@shangkunwang01
shangkunwang01 force-pushed the shangkun-auto-search branch from f563381 to 6cbad68 Compare July 8, 2026 23:02
@shangkunwang01 shangkunwang01 changed the title Implement the graph, worker and orchestrator base classes and parallel search algorithm Implement the graph, worker and orchestrator base classes and parallel search and beam search algorithms Jul 13, 2026
if not graph_db_path:
timestamp = time.strftime("%Y%m%d_%H%M%S")
run_subdir = os.path.join(
os.environ.get("WORKDIR"),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should apply fallback if WORKDIR not set? os.environ.get("WORKDIR", os.getcwd())

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If WORKDIR is not set properly, the run will fail anyway even if you set it as current workdir. The current implementation will throw error to warn users of this issue.

self.root_id = node.node_id

self._update_best_node(node)
self.save()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: add_node() calls self.save() unconditionally, and save() serializes all nodes and does a synchronous file write. Worth considering if we need to rewrite the whole graph on every node add, especially when the graph grows large?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good point but I won't expect the graph to be too large. The db file would typically contain under 100 nodes so it is not issue for now.

* `--log_file`: File path to save the orchestration logs (creates separate `agent.log` and main logs).
* `--graph_db_path`: *(Single-problem only)* Explicit path to a `search_graph.json` file to resume a previously interrupted search.

### Parallel Search Specific Arguments

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which one has better performance so far? Parallel or Beam? Which one is the default to use?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no default one though. User need to specify which one to use.

Comment thread MaxKernel/auto_search/worker.py Outdated

def _prepare_initial_state(self, parent_node: Node) -> Dict[str, Any]:
initial_state = {}
if parent_node.evaluation:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a defensive check here making sure parent_node is not None?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. The current code will not have the case when parent_node is None but I sill add the None check in case later implementation breaks it.

Comment thread MaxKernel/auto_search/worker.py Outdated
compiled = comp_status.get("success", False)
compilation_error = None
if not compiled:
compilation_error = comp_status.get("message", "")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if in json response, it explicitly sets "message": null, this will lead to error. Could you guard against None case?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate a bit on this?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If in the json, there is {"message": null}, what you get from compilation_error = comp_status.get("message", "") will be None, not a string anymore.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@shangkunwang01
shangkunwang01 merged commit 4dbd692 into main Jul 22, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants